<?php

declare (strict_types = 1);

namespace app\store\controller\user;

use app\store\controller\Controller;
use think\App;
use think\response\Json;
use app\store\service\user\Points as PointsService;

class Points extends Controller
{
    private PointsService $pointsService;
    public function __construct(App $app,PointsService $pointsService)
    {
        parent::__construct($app);
        $this->pointsService = $pointsService;
    }

    /**
     * 积分明细
     * @return mixed
     */
    public function log():Json
    {
        $params = $this->request->get();
        $this->validate(
            $params,
            [
                'page' => 'integer',
                'limit' => 'integer',
                //'search' => ''
                //'start_time' => ''
                //'end_time' => ''
            ]
        );
        $list = $this->pointsService->getLog($params);
        return $this->renderSuccess(compact('list'));
    }

}
